import 'package:tiktokadult/hj_model/acg/tag_list_model.dart';
import 'package:tiktokadult/hj_model/actress_model.dart';
import 'package:tiktokadult/hj_model/cartoon_media_info.dart';
import 'package:tiktokadult/hj_model/home/collection_resp.dart';
import 'package:tiktokadult/hj_model/mine/follow_user_list_model.dart';
import 'package:tiktokadult/tools_base/debug_log.dart';

import '../video_model.dart';

class MineCollect<T> {
  bool? hasNext = false;
  List<T>? list;
  int? total;
  MineCollect({this.list, this.hasNext});
  MineCollect.fromJson(Map<String, dynamic> map) {
    hasNext = map['hasNext'] ?? false;
    total = map['total'];
    final type = T.toString();
    if (type == 'VideoModel') {
      list = ((map['list'] as List?)?.map((e) => VideoModel.fromJson(e)).toList() ?? <T>[]) as List<T>;
    }
    if (type == 'TagsBean') {
      list = ((map['list'] as List?)?.map((e) => TagsBean.fromMap(e)).toList() ?? <T>[]) as List<T>;
    }
    if (type == 'FollowUserModel') {
      list = ((map['list'] as List?)?.map((e) => FollowUserModel.fromJson(e)).toList() ?? <T>[]) as List<T>;
    }
    if (type == 'CartoonMediaInfo') {
      list = ((map['list'] as List?)?.map((e) => CartoonMediaInfo.fromJson(e)).toList() ?? <T>[]) as List<T>;
    }
    if (type == 'CollectionModel') {
      list = ((map['list'] as List?)?.map((e) => CollectionModel.fromJson(e)).toList() ?? <T>[]) as List<T>;
    }

    if (type == 'ActressModel') {
      list = ((map['list'] as List?)?.map((e) => ActressModel.fromJson(e)).toList() ?? <T>[]) as List<T>;
    }
  }
}
